#ifndef EYERWANDARTIST_EWAUIWIDGETSCROLL_HPP
#define EYERWANDARTIST_EWAUIWIDGETSCROLL_HPP

#include <limits.h>

#include "EWAUIWidget.hpp"
#include "EWAUILayout.hpp"
#include "EWAUILayoutParams.hpp"
#include "EWAUIProgressBar.hpp"

namespace Eyer
{
    enum class EWAUIWidgetScrollType
    {
        VERTICAL,
        VERTICAL_INVERT,
        HORIZONTAL
    };

    typedef EWAUIWidgetScrollType ScrollType;

    class EWAUIWidgetScroll : public EWAUIWidget
    {
    public:
        EWAUIWidgetScroll(ScrollType _type, EWAUILayoutType contentlayoutType, EWAUILayoutParams width, EWAUILayoutParams height);
        virtual ~EWAUIWidgetScroll();

        virtual bool MousePressEvent     (const Vec2I & pos) override;
        virtual bool MouseReleaseEvent   (const Vec2I & pos) override;
        virtual bool MouseMoveEvent      (const Vec2I & pos) override;

        virtual bool OnScrollEvent       (const double x, const double y) override;
        virtual Vec2I OnMeasure(int suggestWidth, int suggestHeight, int level = 0) override;
        virtual int OnDraw() override;
        virtual int Draw(int level = 0) override;

    public:
        int AddContentWidget(const EyerSmartPtr<EWAUIWidget> & widget);

    public:
        EyerSmartPtr<EWAUILayout> contentLayout;
        EyerSmartPtr<EWAUIProgressBar> progressBar;

        Vec2I scrollOffsetXY;

        ScrollType type = ScrollType::VERTICAL;
    };
}

#endif //EYERWANDARTIST_EWAUIWIDGETSCROLL_HPP
